package com.ncmmall.domain.business.live;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ncmmall.domain.business.goods.Goods;
import com.ncmmall.domain.security.user.WebUser;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import javax.persistence.*;

/**
 * 直播间商品
 *
 * @author likaikai
 * @date 2020-10-29 16:53:37
 */
@Entity
@Table(name = "live_session_goods", indexes = {@Index(columnList = "status")})
@Access(AccessType.FIELD)
@Getter
@Setter
@Accessors(chain = true)
public class LiveSessionGoods {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    /**
     * 直播场次
     */
    @OneToOne
    @JsonIgnore
    @JoinColumn(name = "live_session_id")
    private LiveSession liveSession;

    /**
     * 主播
     */
    @OneToOne
    @JsonIgnore
    @JoinColumn(name = "anchor_id")
    private WebUser anchor;

    /**
     * 关联商品
     */
    @OneToOne
    @JsonIgnore
    @JoinColumn(name = "goods_id")
    private Goods goods;

    /**
     * 主播代播商品
     */
    @OneToOne
    @JsonIgnore
    @JoinColumn(name = "live_goods_anchor_id")
    private LiveGoodsAnchor liveGoodsAnchor;

    /**
     * 普通红包金额
     */
    @Column(name = "common_red_packet_price")
    private double commonRedPacketPrice;

    /**
     * 普通红包发放时间
     */
    @Column(name = "common_red_packet_sec")
    private int commonRedPacketSec;

    /**
     * 普通红包有效时间
     */
    @Column(name = "common_red_packet_hour")
    private int commonRedPacketHour;

    /**
     * 抢购红包金额
     */
    @Column(name = "vie_red_packet_price")
    private double vieRedPacketPrice;

    /**
     * 抢购红包发放时间
     */
    @Column(name = "vie_red_packet_sec")
    private int vieRedPacketSec;

    /**
     * 抢购红包有效时间
     */
    @Column(name = "vie_red_packet_hour")
    private int vieRedPacketHour;

    /**
     * 表示直播间该商品是否已被代播
     * false 未代播
     * true 已代播
     */
    private boolean status;

}
